<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.数组转换为字符串
        var arr = ['齐','楚','燕','韩','赵','魏','秦'];
        console.log(arr.toString()); //齐,楚,燕,韩,赵,魏,秦
        console.log(arr.join()); //齐,楚,燕,韩,赵,魏,秦
        console.log(arr.join('--'));//齐--楚--燕--韩--赵--魏--秦

        // 合并数组
        var arr1 = [25, 58];
        var arr2 = [true, 'hao'];
        var arr3 = arr1.concat(arr2);
        console.log(arr3);//[25, 58, true, "hao"]
        //高级玩法合并数组 // ...展开运算符
        var arr4 = [...arr1, ...arr2];
        console.log(arr4);//[25, 58, true, "hao"]

        //删除元素
        var arr5 = ['齐','楚','燕','韩','赵','魏','秦'];
        //slice  数组.slice(开始下标，结束下标)
        var arr6 = arr5.slice(1,4);
        console.log(arr6); //["楚", "燕", "韩"]

        //splice 数组.splice(开始删除下标，删除几项，补位元素...)
        var arr7 = ['齐','楚','燕','韩','赵','魏','秦'];
        var arr8 = arr7.splice(3,2);
        console.log(arr8); //["韩", "赵"]

        var arr9 = ['齐','楚','燕','韩','赵','魏','秦'];
        arr9.splice(1, 2, 'hao', 34, true);
        console.log(arr9);
    </script>
</body>
</html>